/**==============================================================================
            Copyright (c) 2013 Moritz Hader, Marcel Schrder
            All Rights Reserved.

	@file  InitialActivity.java

	@brief Displays a disclaimer denoting the current development-status of 
	the application and a text-field to choose an IP-adress to connect to the 
	server (Root-Node)
   
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

==============================================================================*/

package de.ibm.dhbw;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class InitialActivity extends Activity {
	
	private EditText ipTextLabel;
	private Intent ARIntent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_initial);
		
		
		//Setup and Handle Button Event
		
		Button button = (Button) findViewById(R.id.connectButton);
		ipTextLabel = (EditText) findViewById(R.id.ipEditView);
		
		ARIntent = new Intent(InitialActivity.this, ARBrowser.class);
		
		button.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
            	
            	//For now, there wont be any regex-testing
            	if(!ipTextLabel.getText().toString().equals("")){
            		
            		//start the next activity
            		
            		ARIntent.putExtra("ISIPADRESS", ipTextLabel.getText().toString());
            		
            		startActivity(ARIntent);
            	}
            }
        });
	} 

}
